import Vue from 'vue'
import Router from 'vue-router'
import Layout from "../views/Layout/index";
import Home from "../views/Layout/Home/index";
import Goods from "../components/Goods/Goods";
import UserModule from "../views/Layout/UserModule/UserModule";
import UserControl from "../views/Layout/UserModule/UserControl";
import RiskyPeo from "../views/Layout/UserModule/RiskyPeo";
import InOutModule from "../views/Layout/InOutModule/InOutModule";
import Control from "../views/Layout/InOutModule/Control";
import HealthPunchModule from "../views/Layout/HealthPunchModule/HealthPunchModule";
import DataPunch from "../views/Layout/HealthPunchModule/DataPunch";
import BinManage from "../views/Layout/BinManage/BinManage";
import PeoInformation from "../views/Layout/BinManage/PeoInformation";
import PeoInOut from "../views/Layout/BinManage/PeoInOut";
import UserService from "../views/User/UserService";
import Login from "../views/User/login";
import Retrieve from "../views/User/Retrieve";
import userCenter from "../views/User/UserCenter";

import AccessApplication from "../views/Layout/UserInOutApplication/AccessApplication";
import Application from "../views/Layout/UserInOutApplication/Application";
import InOutRecord from "../views/Layout/UserInOutApplication/InOutRecord";


Vue.use(Router)

export default new Router({
  routes: [
    { // 登入成功后的页面
      path:"/layout",
      component:Layout,
      name:Layout,
      redirect:'/layout/home',
      meta:{title: '首页', requireAuth:true},
      children:[
        {
          // 住户界面下的出入模块
          path: '/access',
          name: 'AccessApplication',
          component: AccessApplication,
          meta:{title: '出入模块', requireAuth: true},
          redirect:'/access/apply',
          children:[
            {
              // 住户出入申请
              path:'apply',
              name:'Application',
              meta:{title: '出入申请', requireAuth:true},
              component:Application
            },
            {
              // 住户出入申请记录表
              path:'record',
              name:'InOutRecord',
              meta:{title: '出入申请记录', requireAuth:true},
              component: InOutRecord
            }
          ]
        },
        {// 首页
          path: 'home',
          name: 'Home',
          meta:{title: '全国疫情数据展示', requireAuth:true},
          component: Home
        },
        {// 住户模块
          path:'/userModule',
          name:"UserModule",
          redirect:'/userModule/control',
          meta:{title: '住户模块', requireAuth:true},
          component:UserModule,
          children:[
            { // 住户管理模块
              path:'control',
              name:'UserControl',
              meta:{title: '住户管理', requireAuth:true},
              component:UserControl
            },
            {
              //高危用户
              path:'risky',
              name:"RiskyPeo",
              meta:{title: '高危用户', requireAuth:true},
              component:RiskyPeo
            }
          ]
        },
        {
          // 出入模块
          path:'/inOut',
          name:"InOutModule",
          redirect:'/inOut/control',
          meta:{title: '出入模块', requireAuth:true},
          component:InOutModule,
          children:[
            {
              // 住户出入记录登记
              path:'control',
              name:'Control',
              meta:{title: '住户出入记录管理', requireAuth:true},
              component:Control
            }
          ]
        },
        {
          // 健康打卡模块
          path:'/helPunch',
          name:"HealthPunchModule",
          redirect:'/helPunch/data',
          meta:{title: '健康打卡模块', requireAuth:true},
          component:HealthPunchModule,
          children:[
            { // 每日健康打卡
              path:'data',
              name:"DataPunch",
              meta:{title: '每日健康打卡', requireAuth:true},
              component: DataPunch
            }
          ]
        },
        {
          // 垃圾箱管理
          path:"/binManage",
          name:'BinManage',
          redirect:'/binManage/peoInf',
          meta:{title: '垃圾箱管理', requireAuth:true},
          component:BinManage,
          children:[
            { // 住户信息
              path:'peoInf',
              name:'PeoInformation',
              meta:{title: '住户信息', requireAuth:true},
              component: PeoInformation
            },
            {
              // 住户出入信息
              path:'peoInOut',
              name:'PeoInOut',
              meta:{title: '住户出入信息', requireAuth:true},
              component: PeoInOut
            }
          ]
        },
        {
          //个人中心
          path:'/userCenter',
          name:'userCenter',
          meta:{title: '个人信息',requireAuth: true},
          component: userCenter
        },
        {
          // 这个留着有用，之后会删除
          path:'/goods',
          name:'Goods',
          component:Goods
        }
      ]
    },
    {
      // 登录注册页面
      path:'/',
      name:'UserService',
      component:UserService,
      redirect:'/login',
      children:[
        {// 登录注册组件
          path:'login',
          name:'Login',
          component: Login
        },
        {// 忘记密码组件
          path:'retrieve',
          name:'Retrieve',
          component: Retrieve
        }
      ]
    }
  ]
})
